import itertools
import random
import string


def find_number_of_digits(A):
    max = A[0]
    for i in range(0, len(A)):
        if A[i] > max:
            max = A[i]
    return len(str(max))


def radix_sort(A):
    k = 0
    B = [[] for _ in range(0, 10)]

    max_len = find_number_of_digits(A)

    while k < max_len:
        for i in range(0, len(A)):
            k_digit = int((A[i] / 10 ** k) % 10)
            B[k_digit].append(A[i])

        A = list(itertools.chain(*B))
        B = [[] for _ in range(0, 10)]
        k += 1
    return A


def generate_random_str(randomlength: int) -> string:
    """
    生成一个指定长度的随机字符串，其中
    string.digits=0123456789
    string.ascii_letters=abcdefghigklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
    """
    str_list = [random.choice(string.digits + string.ascii_letters) for _ in range(randomlength)]
    random_str = ''.join(str_list)
    return random_str


def generate_random_str_list() -> list[str]:
    """
    :return:
    """
    count = int(input("请输入字符串数量:"))
    randomlist = random.sample(range(5, 20), count)
    str_list = []
    for lenth in randomlist:
        str_list.append(generate_random_str(lenth))
    return str_list


if __name__ == '__main__':
    print(generate_random_str_list())
    # A = [1, 5, 15, 99, 666]
    # B = radix_sort(A)
    # print(B)
